#pragma once
#include <QObject>
#include <QFile>

class MIniFile;

class MHttp;
class MSqldb;
class MKVdb;
class MDocdb;
class MDirDB;

#define INI_FILE_REL_PATH "/Fish-MD.ini"
#define WEB_FILE_REL_PATH "/md/md.html"
#define INFO_FILE_REL_PATH "/qmd.info"

class MGlobal
{
public:
	MGlobal();
	~MGlobal();
public:
	bool instance();
	void uninstance();

	const QString &getWorkPath();
	MIniFile *getIniFile();
	MHttp *getHttp();

	MKVdb *getKVDB();
	MDocdb *getDocDB();
	MDirDB *getDirDB();

	QString getUserName();
	void setUserName(const QString &name);

	QFile *getLogFile();

protected:
	bool loadIni(const QString &workPath);
	QString checkWorkPath();

private:
	QString m_workPath;
	MIniFile *m_ini;
	MHttp *m_http;
	MSqldb *m_db;
	QString m_userName;
	QFile *m_logFile;
};

